﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Demos.DesignPatterns._22_状态模式
{
    /// <summary>
    /// 订单创建状态
    /// </summary>
    public class CreatedState:IOrderState
    {
        public void Process(Order order)
        {
            Console.WriteLine("订单创建状态：处理订单");
            order.SetState(new ProcessedState());
        }

        public void Ship(Order order) => Console.WriteLine("错误：订单尚未处理完成，不能发货");
        public void Deliver(Order order) => Console.WriteLine("错误：订单尚未发货，不能完成配送");
        public void Cancel(Order order)
        {
            Console.WriteLine("订单已取消");
            order.SetState(new CancelledState());
        }
    }
}
